package com.adong.test;

import com.adong.config.AutoConfig;
import com.adong.pojo.Boss;
import com.adong.pojo.Car;
import com.adong.service.UserService;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author adong
 */

public class AutoDemo {
    @Test
    public void test() {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AutoConfig.class);
        UserService userService = applicationContext.getBean("userService", UserService.class);
        userService.print();
        System.out.println(userService);
    }

    @Test
    public void test1() {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AutoConfig.class);
        Boss boss = applicationContext.getBean("boss", Boss.class);
        System.out.println(boss);
        Car car = applicationContext.getBean("car", Car.class);
        System.out.println(car);
    }

    @Test
    public void test2(){
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AutoConfig.class);
        System.out.println(applicationContext);
    }
}
